package day4;

/**
 * @author joker
 * @date 2022/4/14 0014 - 14:22
 */
public class TestThread {
    public static void main(String[] args) {
//        MyThread t1=new MyThread();
////      t1.setPriority(10);
//        t1.start();
//        Thread.currentThread().setPriority(1);

        // Thread方式



        //runnable

        for (int i = 0; i < 100; i++) {

            if (i%2==0){
                System.out.println(Thread.currentThread().getName()+":"+i);
                try {
                    Thread.sleep(5);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    if (i%2==0){
                        System.out.println(Thread.currentThread().getName()+":"+i);

                    }
                }
            }
        }).start();

    }
}
